﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Yss.KTable.Models;

namespace YssTestMain
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //for (int i = 0; i < 20; i++)
            //{
            //    for (int j = 0; j < 5; j++)
            //    {
            //        Button btn = new Button();
            //        btn.Text = "A" + i.ToString() + j.ToString();
            //        btn.Location = new Point(j * btn.Width, i * btn.Height);
            //        panel1.Controls.Add(btn);
            //    }
            //}

            Row firstRow = new Row();
            firstRow.Cells.Add(new Cell("AAA"));
            firstRow.Cells.Add(new Cell("BBB"));
            firstRow.Cells.Add(new Cell("CCC"));

            for (int i = 0; i < 3; i++)
            {
                Row secondRow = new Row();
                secondRow.Cells.Add(new Cell("A"+i));
                //secondRow.Cells.Add(new Cell("B" + i));
                secondRow.Cells.Add(new Cell(new Button()));
                secondRow.Cells.Add(new Cell("C" + i));
                firstRow.SubRows.Add(secondRow);
                
                for (int j = 0; j < 3; j++)
                {
                    Row thirdRow = new Row();
                    thirdRow.Cells.Add(new Cell("A"+i+j));
                    thirdRow.Cells.Add(new Cell("B" + i + j));
                    thirdRow.Cells.Add(new Cell("C" + i + j));

                    secondRow.SubRows.Add(thirdRow);

                    for (int k = 0; k < 3; k++)
                    {
                        Row fouthRow = new Row();
                        fouthRow.Cells.Add(new Cell("A" + i + j + k));
                        fouthRow.Cells.Add(new Cell("B" + i + j + k));
                        fouthRow.Cells.Add(new Cell("C" + i + j + k));

                        thirdRow.SubRows.Add(fouthRow);

                        for (int l = 0; l < 3; l++)
                        {
                            Row fifth = new Row();
                            fifth.Cells.Add(new Cell("A" + i + j + k + l));
                            fifth.Cells.Add(new Cell("B" + i + j + k + l));
                            fifth.Cells.Add(new Cell("C" + i + j + k + l));

                            fouthRow.SubRows.Add(fifth);
                        }
                    }
                }

            }

            table1.Rows.Add(firstRow);
            table1.ReadOnly = true;
        }
    }
}
